<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="java.util.ArrayList"%>
<%@page import="model.ThanhVienModel"%>
<%@page import="dao.ThanhVienDAO"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	<div>
		<h1 align="center">Home Page</h1>
		<h3>Xin chao: 
			<%
				String tenDangNhap = request.getAttribute("tenDangNhap").toString();
				String vaiTro = request.getAttribute("vaiTro").toString();
				out.println(tenDangNhap);
			%> Vai tro la :<%=vaiTro %>
		</h3>
		
		<table border="1">
			<tr>
				<th>&nbsp;</th>
				<th> ID </th>
				<th> Ten Dang Nhap </th>
				<th> Mat Khau </th>
				<th> Vai Tro </th>
				<th> Ghi Chu </th>
			</tr>
		<%
			ArrayList<ThanhVienModel> listThanhVien = ThanhVienDAO.getAllThanhVien();
			for(ThanhVienModel model : listThanhVien) {
				out.println("<tr><td><input type='checkbox'name='aa'value='"+model.getId()+"'/></td>");
				out.println("<td>" + model.getId() + "</td><td>" 
							+ model.getTenDangNhap() + "</td><td>"
							+ model.getMatKhau() + "</td><td>"
							+ model.getVaiTro() + "</td><td>"
							+ model.getGhiChu() + "</td></tr>");
			}
			
		 %>
		</table>
		<a href="themMoi.jsp">Them Moi</a>
	</div>
</body>
</html>